

// 19、定义一个点类Point，包含2个成员变量x、y分别表示x和y坐标，2个构造器Point()和Point(int
// x0,y0),以及一个movePoint（int dx,int dy）方法实现点的位置移动，创建两个Point对象p1、p2，分别
// 调用movePoint方法后，打印p1和p2的坐标。

package Point.test;

public class Point {
    private double x;
    private double y;
    public Point(double x0,double y0) {
        this.x=x0;
        this.y=y0;
    }
    public Point() {
        super();
    }

    public double getX() {
        return x;
    }
    public void setX(double x) {
        this.x = x;
    }
    public double getY() {
        return y;
    }
    public void setY(double y) {
        this.y = y;
    }
    public void movePoint(double dx,double dy) {
        x+=dx;
        y+=dy;

    }
    public static void main(String[] args) {
        Point p1 = new Point (3,4);
        p1.movePoint(2, 5);
        System.out.println("p1坐标为:"+p1.x+","+p1.y);

        Point p2 = new Point (6,8);
        p2.movePoint(50, 60);
        System.out.println("p2坐标为:"+p2.x+","+p2.y);
    }

}